
//载入模块
 let fs = require("fs");
 let user = { username:"admin1",password:"12345" };
 let txt = fs.readFileSync("person.json");
 let userinfo = JSON.parse(txt.toString())

  let result = userinfo.find((value)=>{
	  return value.username == user.username;
  })
  if(result)
  {
	  console.log("用户名被占用");
  }
  else
  {
	  userinfo.push(user);
	  let toregister = fs.writeFileSync("person.json",JSON.stringify(userinfo));
	  if(toregister == undefined)
	  {
		  console.log("注册成功");
	  }
  }